package com.imoblife.brainwavestus;

import java.util.ArrayList;

import com.imoblife.brainwavestus.adapter.AllProductCategoryAdapter;
import com.imoblife.brainwavestus.listener.OnCategoryItemClickListener;
import com.imoblife.brainwavestus.model.Constant;
import com.imoblife.brainwavestus.util.DebugUtil;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;


public class GroupAllProductCategoryActivity extends BaseActivity {
	
	private ListView mLvCategroy;
	private ArrayList<String> mCategories;
	private Context mCtx;
	
	@Override
	protected void onCreate(Bundle arg0) {
		
		super.onCreate(arg0);
		
		setContentView(R.layout.phone_category_product_list);
		
		mCtx = this;
		initTitleName(getString(R.string.store));
		mLvCategroy = (ListView)findViewById(
						R.id.lv_category_product);		
		AllProductCategoryAdapter adapter = 
				new AllProductCategoryAdapter(this, 
						R.layout.category_item);
		
		mCategories = getBrainWavesApplication().getStore()
							.getAllCategories();
		
		mCategories.add(0, getString(R.string.all_category));
		
		for(String category : mCategories){
			
			DebugUtil.dbDebug(TAG, "add category:" + category);
		}
		
		adapter.setData(mCategories);
		
		mLvCategroy.setAdapter(adapter);
		mLvCategroy.setOnItemClickListener(
				new OnCategoryItemClickListener(mCtx,
						mCategories,
						Constant.SOURCE_FROM_STORE));		
	}
	
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

	
}
